VObject

Section: ET++ class description (n)
Updated: automatically Mon Apr 8 20:17:57 1991
Index Return to Main Contents
 

NAME

VObject.short - base class for all visual objects drawn on the screen  

DESCRIPTION

VObject (visual object) is the most general graphical class in ET++ and, in this respect, corresponds to the class Object in the overall class hierarchy. It defines the abstract protocol for managing the size of graphical shapes, for input handling and for drawing on the screen.


Metric and Baseline


A VObject is located at a certain position in a window and occupies some space thereof. This is called the content rectangle specified by its origin and extent. It is stored in the instvar contentRect. The content rectangles of all VObjects contained in a window are calculated when the window is opened the first time and whenever it is resized. During the calculation of the window layout each VObject must calculate its own minimum size which is an instance of the class Metric and which is returned by the method GetMinSize. The available space for a VObject may be greater than its minimum size. In this case the flags eVObjHFixed and eVObjVFixed (see enum VObjFlags) control whether a VObject may be expanded in the respective direction.
VObjects dealing with text are often aligned at their baseline. This is the line below which letters like 'g' descend. The baseline must be calculated by the method Base and also returned by the method GetMinSize as part of the Metric (see above). For example, the class TextItem determines its metric based on the used font and the string to be shown.
See also technote Layout Management.


Layout and VObject Tree


Complex window layouts are built by combining several VObjects into a single, composite object which can be treated as one VObject. The composite object can again be a part of another composite object, and so on. Therefore the VObjects in a window are organized in a tree-like fashion.
The abstract class CompositeVObject manages a list of VObjects and applies methods executed on itself to all of its components. The actual layout management is up to its subclasses. They have to override the method GetMinSize, the method SetOrigin and the method SetExtent in order to divide the available space between their components; e.g. the class Cluster aligns VObjects within rows and columns. Another example for a composite VObject is the class VObjectPair that arranges two VObjects horizontally.
See also technote Layout Management.


Drawing


ET++ uses an indirect drawing scheme which consists of two steps: invalidation and drawing. The application announces which objects must be redrawn by calling the method ForceRedraw or the method InvalidateRect. The window collects the invalidated areas and redraws them after the next input event is processed. The method UpdateEvent can be used to force any pending update to be done immediately.
The actual drawing must be done in the method Draw which is called when the invalid regions of a window are updated. Drawing occurs on output ports and the class Port provides a rich set of device-independent methods for graphics primitives such as lines, rectangles, ovals, polygons, bitmaps, and more.
If a VObject is selected (e.g. a menu item), then it should be highlighted somehow in order to give a feedback to the user. Highlighting is done by the method DrawHighlight which, by default, draws the VObject in a different color, respectively inverts it on monochrome screens.
See also technote Invalidation and Drawing and technote Drawing Model.


Event Dispatching


If the mouse cursor is located over a VObject, then this VObject gets all mouse and keyboard events. Events are distributed by the window with instances of the class Token. The method DispatchEvents examines the input token and dispatches it to the corresponding Do...Command methods, such as the method DoLeftMouseButtonDownCommand or the method DoKeyCommand. The default action of these methods is to propagate the event up in the VObject tree to the instvar container. In order to react to a specific event the corresponding method must be overridden.
See also technote Event Handling.


Menu


When the right mouse button is pressed while the mouse cursor is over a VObject, then a popup menu is displayed at the current mouse position. The menu is created and menu commands can be processed by overriding the methods: method GetMenu, method DoCreateMenu, method DoSetupMenu and method DoMenuCommand. The default action of these methods is to forward the method to the next event handler which is the instvar container, by default.
See cookbook Menus and technote Event Handling for details.


classes are always derived from VObject.
class VObject is never reused directly.
class VObject is abstract.
class VObject contains 81 methods.

owner of class:
nobody.
baseclasses:
EvtHandler
subclasses:
Clipper, CompositeVObject, Filler, GraphPath, GraphReference, ImageItem, LineItem, SplitBar, TextItem, Thumb, VObjectPair, View
flags:
VObjFlags

 

INSTANCE VARIABLES

container (private VObject *)
is the parent of this VObject. VObjects are organized in a tree-like fashion and every VObject is geometrically contained in its parent. Therefore the container of a window (see class BlankWin), which is the root of the VObject tree, is always NULL. When a window is opened the first time, the parent of a VObject initializes the container of its inner VObjects through the method SetContainer. The container can be accessed through the method GetContainer. The container is also returned as next event handler by the method VObject::GetNextHandler.
See also technote VObject Tree.

contentRect (public Rectangle)
contains the bounding box, i.e. the origin and the extent of the VObject. The origin is always relative to the next container of class Clipper because every Clipper maintains its own coordinate system. The contentRect is very often accessed directly, but it should be modified only via the appropriate methods.

id (private short)
is a clear identification of the VObject. It can be chosen either from predefined (cId...) or from user-defined constants which must be greater than const cIdFirstUser. The default value of the id is const cIdNone. The id is returned by the method GetId and can be set with the method SetId.
The id need not be unique throughout the whole application. But it must identify a VObject in a given context. Dialogs examine the id in their Control method to find out which button has been pressed. Some dialog items pass the id to the method SendDown to make other VObjects do certain things. E.g., method ChangeDialog::Control, method Button::DoOnItem or method OneOfCluster::SetItemOn.

 

INSTANCE METHOD LIST

accessing
ContentRect
Enabled
GetContainer
GetExtent
GetId
GetOrigin
Height
IsOpen
WantsKbdFocus
Width

client interface
SetId

commands
GetMover
GetStretcher

comparison
AsString

constructor
VObject

container handling
AddToClipper
ContainerPoint
FindContainerOfClass
GetPortPoint
GetView
GetWindow
Getclipper
RemoveFromClipper
SetContainer

content rectangle
Align
ContainsPoint
GetViewedRect
Move
SetContentRect
SetExtent
SetHeight
SetOrigin
SetWidth

detect
Detect
FindItem
FindItemPtr

drawing
Draw
DrawAll
DrawHighlight
DrawInner
Highlight
Outline
Outline2
OutlineRect
UpdateEvent

event handling
DispatchEvents
DoCursorKeyCommand
DoFunctionKeyCommand
DoKeyCommand
DoLeftButtonDownCommand
DoMiddleButtonDownCommand
DoOnItem
DoOtherEventCommand
DoRightButtonDownCommand
GetCursor
Input

flag handling
Close
Disable
Enable
Open

focusing
Focus
SetFocus

implementation
Init

invalidation
ForceRedraw
InvalidateRect
InvalidateViewRect

layout calculation
Base
CalcExtent
GetMinSize

mouse tracking
TrackInContent

miscellaneous
Compare
GetNextHandler
IsEqual
PrintOn
ReadFrom

printing
Print

 

CATEGORIES

Graphic Foundation

 

FILES

declaration:
VObject.h

 

HISTORY

joe    - Mon Apr 15 16:52 MET DST 1991 - first version

joe    - Wed Jun 12 20:51 MET DST 1991 - reworked

joe    - Thu Jun 13 23:30 MET DST 1991 - reworked after chris' review


 

Index

NAME
DESCRIPTION
INSTANCE VARIABLES
INSTANCE METHOD LIST
CATEGORIES
FILES
HISTORY

This document was created by man2html, using the manual pages.
Time: 00:40:22 GMT, March 30, 2022